package com.hsoft.zhxy.app.xtgl_02_01.controller;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.hsoft.zhxy.app.xtgl_02_01.service.JcggYbmxService;
import com.hsoft.zhxy.app.common.model.entity.JcggYbmx;

@Api(tags = "xtgl_02_01 已办明细")
@Log4j2
@Validated
@RestController
@RequestMapping(value = "/xtgl_02_01/jcggYbmx/", produces = "application/json;charset=UTF-8")
public class JcggYbmxController {

    @Autowired
    private JcggYbmxService jcggYbmxService;

    @ApiOperation(value = "查询单条数据", notes = "查询单条数据")
    @GetMapping("findOne")
    public JSONObject findOne(JcggYbmx jcggYbmx) {
        return jcggYbmxService.findOne(jcggYbmx);
    }


    @ApiOperation(value = "查询列表数据", notes = "查询列表数据")
    @GetMapping("findList")
    public JSONObject findList(JcggYbmx jcggYbmx) {
        return jcggYbmxService.findList(jcggYbmx);
    }
    
    
    @ApiOperation(value = "查询分页列表数据", notes = "查询分页列表数据")
    @GetMapping("findListByPage")
    public JSONObject findListByPage(JcggYbmx jcggYbmx,
                                        @Valid @NotNull(message = "页码为空") long page,
                                        @Valid @NotNull(message = "分页行数为空") long pageSize) {
        return jcggYbmxService.findListByPage(jcggYbmx, page, pageSize);
    }
    
    
    @ApiOperation(value = "新增", notes = "新增")
    @PostMapping("add")
    public JSONObject add(@RequestBody @Valid JcggYbmx jcggYbmx) {
        return jcggYbmxService.add(jcggYbmx);
    }
    
    
    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("update")
    public JSONObject update(@RequestBody @Valid JcggYbmx jcggYbmx) {
        return jcggYbmxService.update(jcggYbmx);
    }

    @ApiOperation(value = "删除", notes = "删除")
    @PostMapping("delete")
    public JSONObject delete(@RequestBody JcggYbmx jcggYbmx) {
        return jcggYbmxService.delete(jcggYbmx);
    }
    
    
    // 各方法命名需要以 find、add、update、delete开头，遵循驼峰原则


}